<?php
R('Admin.Login','islogin');
class AdminAction extends Action
{
	public function adminlist()
	{
		$db = M('admins');
		$list = $db->select();
		$this->assign('list',$list);
		$this->display();
	}
	
	//删除管理员
	
	public function deladmin()
	{
		if(!isset($_POST['id']))
		{
			exit('参数错误,管理员id不能为空');
		}
		$DB = M('admins');
		$DB->where('id='.$_POST['id'])->delete();
	}
	
	public function savepassword()
	{
		$id = $_SESSION['member']['id'];
		$DB = M('admins');
		$data['password'] = md5($_POST['password']);
		$DB->where('id='.$id)->save($data);
		echo '修改成功!';
	}
	
	public function save()
	{
		$DB = D('admins');
		$DB->create() or die( $DB->getError() . '<a href="javascript:window.history.go(-1)">返回</a>');
		$DB->add();
		echo '添加成功 ';
	}
}